package com.test.controller;

import com.common.framework.context.ApplicationContext;
import com.common.framework.context.support.ClassPathXmlApplicationContext;
import com.test.service.UserService;

/**
 * @ClasName UserController
 * @Descripution TODO
 * @Author USER
 * @Date 2022/2/28 16:21
 * @Version V1.0
 */
public class UserController {

    public static void main(String[] args) throws Exception {
        //1,创建spring的容器对象
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
        //BeanFactory beanFactory = new XmlBeanFactory(new ClassPathResource("applicationContext.xml"));
        //2,从容器对象中获取userService对象
        UserService userService = applicationContext.getBean("userService", UserService.class);
        //3,调用userService方法进行业务逻辑处理
        userService.add();
    }

}
